package com.lry.user;

import com.lry.client.RpcClient;
import com.lry.message.Message;
import com.lry.producer.DefaultMqProducer;
import com.lry.producer.SendResult;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;

@SpringBootApplication
public class UserApplication implements CommandLineRunner {

    public static void main(String[] args) {

        SpringApplication.run(UserApplication.class, args);
    }

    @Resource
    private DefaultMqProducer pointsProducer;

    @Override
    public void run(String... args) throws Exception {
        Message message = new Message();
        message.setTopic("topic");
        message.setBody("hello world".getBytes(StandardCharsets.UTF_8));
        SendResult send = pointsProducer.send(message);
        System.out.println(send);
    }
}
